package dbModle

import "wonlicsys/utils"

// AdminUser [...]
type AdminUser struct {
	AdminId   uint         `gorm:"primaryKey;column:admin_id;type:int unsigned;not null"`
	Status    int8         `gorm:"column:status;type:tinyint;not null;default:2"`          // 状态 2 正常 3 禁用
	UserName  string       `gorm:"column:user_name;type:varchar(255);not null;default:''"` // 用户名
	Password  string       `gorm:"column:password;type:varchar(125);not null;default:''"`  // 密码
	Role      int8         `gorm:"column:role;type:tinyint;not null;default:1"`            // 角色 1 管理员 2 技术 3 商务 4 销售
	CreatedAt utils.Time20 `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP"`
	UpdatedAt utils.Time20 `gorm:"column:updated_at;type:timestamp;not null;default:CURRENT_TIMESTAMP"`
}

// OaComponent [...]
type OaComponent struct {
	OaComponentId       uint         `gorm:"primaryKey;column:oa_component_id;type:int unsigned;not null"`
	OaTempId            uint         `gorm:"column:oa_temp_id;type:int unsigned;not null"`                        // 关联的oa审批模版
	OaFormComponentId   string       `gorm:"column:oa_form_component_id;type:varchar(255);not null;default:''"`   // 控件id
	OaFormComponentType string       `gorm:"column:oa_form_component_type;type:tinyint(1);not null;default:1"`    // 控件类型,1：单行输入框,,2：多行输入框,,3：数字输入框,,4：单选框,,5：多选框,,6：日期控件,,7：时间区间控件,,8：文字说明控件,,9：电话控件,,10：图片控件,,11：金额控件,,12：明细控件,,13：附件,,14：联系人控件,,15：关联审批单,,17：关联控件,,18：省市区控件,,19：评分控件,,20：部门控件
	OaFormComponentName string       `gorm:"column:oa_form_component_name;type:varchar(255);not null;default:''"` // 控件名称
	CreatedAt           utils.Time20 `gorm:"column:created_at;type:timestamp;not null;default:CURRENT_TIMESTAMP"`
	UpdatedAt           utils.Time20 `gorm:"column:updated_at;type:timestamp;default:null;default:CURRENT_TIMESTAMP"`
}

// OaTemplate [...]
type OaTemplate struct {
	OaTempId          uint         `gorm:"primaryKey;column:oa_temp_id;type:int unsigned;not null"`
	OaTempName        string       `gorm:"column:oa_temp_name;type:varchar(125);not null;default:''"` // 审批表单名称
	OaTempDescription string       `gorm:"column:oa_temp_description;type:varchar(255);not null"`     // 描述
	OaTempProcessCode string       `gorm:"column:oa_temp_process_code;type:varchar(255);not null"`    // 审批表单formCode
	CreatedAt         utils.Time20 `gorm:"column:created_at;type:timestamp;default:null;default:CURRENT_TIMESTAMP"`
	UpdatedAt         utils.Time20 `gorm:"column:updated_at;type:timestamp;default:null;default:CURRENT_TIMESTAMP"`
}

// OaProcessInstances [...]
type OaProcessInstances struct {
	Id                 int          `gorm:"primaryKey;column:id;type:int;not null"`
	OaTempId           int          `gorm:"column:oa_temp_id;type:int;not null;default:0"`                      // 模版id
	OaInstanceId       string       `gorm:"column:oa_instance_id;type:varchar(126);not null;default:''"`        // 申请实例id
	OaProcessCode      string       `gorm:"column:oa_process_code;type:varchar(126);not null;default:''"`       // processCode
	OaOriginatorUserId string       `gorm:"column:oa_originator_user_id;type:varchar(126);not null;default:''"` // 发起审批人id	OaActionType       string       `gorm:"column:oa_action_type;type:varchar(25);not null;default:''"`        // 审批类型 AND：会签 OR：或签 NONE：单人审批,
	OaUserIds          string       `gorm:"column:oa_user_ids;type:varchar(256);not null"`                      // 审批人多个用逗号隔开
	CreatedAt          utils.Time20 `gorm:"column:created_at;type:timestamp;default:null;default:CURRENT_TIMESTAMP"`
	UpdatedAt          utils.Time20 `gorm:"column:updated_at;type:timestamp;default:null;default:CURRENT_TIMESTAMP"`
}
